<%--
  Created by IntelliJ IDEA.
  User: 86002
  Date: 2021/7/1
  Time: 9:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>员工列表</title>
    <%
        pageContext.setAttribute("APP_PATH", request.getContextPath());
    %>

    <script type="text/javascript" src="${APP_PATH }/static/js/jquery-1.12.4.min.js"></script>
    <link href="${APP_PATH }/static/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="${APP_PATH }/static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <h1>SSM-CRUD</h1>
        </div>
<%--        <button class="btn btn-primary btn-sm">--%>
<%--            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>--%>
<%--            增加--%>
<%--        </button>--%>
<%--        <button class="btn btn-danger btn-sm">--%>
<%--            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>--%>
<%--            修改--%>
<%--        </button>--%>
    </div>
    <div style="position: relative;bottom: 30px;left: 180px" class="row">
        <div class="col-md-4 col-md-offset-8">
            <button class="btn btn-primary" id="emp_add_modal_btn">新增</button>
            <button class="btn btn-danger" id="emp_delete_all_btn">删除</button>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-hover">
                <tr>
                    <th class="col-md-2">编号</th>
                    <th class="col-md-2">姓名</th>
                    <th class="col-md-2">性别</th>
                    <th class="col-md-2">邮箱</th>
                    <th class="col-md-2">部门</th>
                    <th class="col-md-2">操作</th>
                </tr>

                <c:forEach items="${pageinfo.list}" var="user">
                    <tr>
                        <th>${user.empId}</th>
                        <th>${user.empName}</th>
                        <th>${user.gender}</th>
                        <th>${user.email}</th>
                        <th>${user.tblDept.deptName}</th>
                        <th>
                            <button class="btn btn-primary btn-sm">
                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                编辑
                            </button>
                            <button class="btn btn-danger btn-sm">
                                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                                删除
                            </button>
                        </th>
                    </tr>
                </c:forEach>
            </table>

        </div>
    </div>

    <div class="row">
        <c:set var="page" value="${pageinfo}"></c:set>
        <div class="col-md-6">
            共${page.total}数据 当前${page.pageNum}/${page.pages}
        </div>
        <div class="col-md-6">
            <button class="btn btn-primary btn-sm"><a href="${APP_PATH}/pagelist?pn=1" style="text-decoration: none; color: white" >首页</a></button>
            <c:if test="${page.hasPreviousPage}">
                <button class="btn btn-primary btn-sm"><a href="${APP_PATH}/pagelist?pn=${page.pageNum-1}" style="text-decoration: none; color: white" ><<</a></button>
            </c:if>
            <c:forEach items="${pageinfo.navigatepageNums}" var="pageNo">
                <button class="btn btn-primary btn-sm"><a href="${APP_PATH}/pagelist?pn=${pageNo}" style="text-decoration: none; color: white" >${pageNo}</a></button>
            </c:forEach>
            <c:if test="${page.hasNextPage}">
                <button class="btn btn-primary btn-sm"><a href="${APP_PATH}/pagelist?pn=${page.pageNum+1}" style="text-decoration: none; color: white" >>></a></button>
            </c:if>

            <button class="btn btn-primary btn-sm"><a href="${APP_PATH}/pagelist?pn=${page.pages}" style="text-decoration: none; color: white" >尾页</a></button>
        </div>
    </div>
</div>


</body>
</html>
